package com.example.ds.controller;

import com.example.ds.model.Account;
import com.example.ds.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;

@RestController
public class AccountController {

    @Autowired
    private AccountService accountService;

    @GetMapping("/accounts")
    public List<Account> list() throws InterruptedException {
        Thread.sleep(10);
        return accountService.list();
    }


    @GetMapping("/accounts2")
    public List<Account> list2() throws InterruptedException {
        Thread.sleep(10);
        return accountService.accountList("arg1", 2);
    }
}
